package kr.nexmore.slmsample2.dao;

import java.util.List;

import kr.nexmore.slmsample2.db.HibernateUtil;
import kr.nexmore.slmsample2.vo.HandiVo;

import org.hibernate.Session;

/**
 * 하이버네이트로..
 * 
 * @author HY
 * @date : 2014. 9. 2.
 * 
 */
public class HandiDao {

	public void insert(HandiVo vo) {
		Session session = HibernateUtil.getCurrentSession();
		session.beginTransaction();
		session.save(vo);
		session.getTransaction().commit();
		HibernateUtil.closeSession();

	}

	public void update(HandiVo vo) {

	}

	public List<HandiVo> list() {
		List<HandiVo> result = null;

		Session session = HibernateUtil.getCurrentSession();
		session.beginTransaction();

		HandiVo vo = (HandiVo) session.get(HandiVo.class, 2);

		System.out.println(vo.toString());
		HibernateUtil.closeSession();

		return result;
	}

	public HandiVo getVo(int id) {
		Session session = HibernateUtil.getCurrentSession();
		session.beginTransaction();

		HandiVo vo = (HandiVo) session.get(HandiVo.class, 2);

		HibernateUtil.closeSession();

		return vo;

	}

}
